<!-- indexController.php -->
<?php
	require 'Controller.php';
	require 'Home/Model/IndexModel.php';
	class IndexController extends Controller{
		function __Construct(){
			parent::__Construct();
			$this->model = new indexModel();
		}

		function index(){
			$data=$this->model->getallcourse();
			$data1 = $this->model->getclasstype();

			 $data3= $this->model->getnotice();
			// $this->assign('novelhittimes',$data2);
			//
			// $data3 = $this->model->getnovelinfor();
			// $this->assign('novelinfor',$data3);

		include 'Home/View/index/index.php';

		}
		function choose(){
			$id=$_GET['id'];
			$data=$this->model->getchoose($id);
			$data1 = $this->model->getclasstype();

			 $data3= $this->model->getnotice();
if($data)
{		echo '选课成功'.'<a href="index.php?c=index&m=lists&ctid=1">如果没有跳转，请点这里跳转</a>';}

		}
		function chooselist()
		{ 		$data1=$this->model->getclasstype();
			$data=$this->model->getchooselist();
			include 'Home/View/index/chooselist.php';
		}
		function delchoose(){
			$id=$_GET['id'];
			$result=$this->model->getdelchoose($id);
			if($result)
			{		echo '退选成功'.'<a href="index.php?c=index&m=lists&ctid=1">如果没有跳转，请点这里跳转</a>';}

					}


		function lists(){
			//ctid 系别的id
			//
			$id=$_GET['ctid'];
			$data = $this->model->getclass($id);
			$data2=$this->model->getallcourse();
				$data1=$this->model->getclasstype();
			 $data3= $this->model->getnotice();

			 //$id1=$_GET['cid'];
			 //$data4=$this->model->getchoose($id1);



			// $data2 = $this->model->gethittimes();
			// $this->assign('novelhittimes',$data2);
			//
			// $data3 = $this->model->getnovelinfor();
			// $this->assign('novelinfor',$data3);
			//
			// $data4 = $this->model->getnovellist($id);
			// $this->assign('novellist',$data4);
			//
	include 'Home/View/index/lists.php';
	}

		function show(){
			$id=$_GET['cid'];

			$data1 = $this->model->getcourse($id);

			$data2=$this->model->getclasstype();
			$data3=$this->model->getnotice();


			//
			// $data2 = $this->model->getnovelinfor();
			// $this->assign('novelinfor',$data2);
			//
			// $data3 = $this->model->getnovelshow($id);
			// $this->assign('novelshow',$data3);

				include 'Home/View/index/show.php';
		}


		function login(){
			$rs = $this->model->doLogin();
			echo $rs."<br/>";
			if($rs) {
				session_start();
				$_SESSION["user"]=$u;
				header("location:index.php");
			} else {
				header("location:index.php?re=1&msg=");
			}


		}
	}

 ?>
